#This script produces Table S1 in the Supplemental Appendix

setwd("/Users/bsjjones/Dropbox/JoestenJones/PB R&R")

library(foreign)
library(rmeta)
library(plotrix)

pdf("figure_FAIR.pdf", width=7, height=7)
###FAIR ANALYSIS####
par(mfrow=c(1,2), oma=c(3,4,2,2), mar=c(4,2,1,1)+.01)

######POSITION: REPUBLICANS######

midterm<-read.dta("repfairpriority.dta")

attach(midterm)

plot(x=fairprop, y=rep_position, pch=20, xlab="FAIR Key Votes", ylab="Position", 
     main="A. Position and FAIR Votes", ylim=c(1,7), xlim=c(0,1), yaxt="n", col="black", cex.axis=.65, cex.main=.75, cex.lab=.65)
lines(xbpos~fairprop, lty=1)
axis(2, at=(1:7), labels=c("Path-to-Citizenship", "2", "3", "4", "5", "6", "Forced to Return"), las=2, cex.axis=.65)
legend("topleft", c("Democrat Incumbent", "Republican Incumbent"), pch=c(20, 20), bty="n", cex=.65, col=c("grey50", "black"))

rm(list=ls())
par(new=TRUE)
#####POSITION:DEMOCRATS#############

midterm<-read.dta("demfairpriority.dta")

attach(midterm)


plot(x=fairprop, y=dem_position, pch=20, xlab="", ylab="", yaxt="n",
     main="", ylim=c(1,7), xlim=c(0,1), col="grey50", cex.axis=.65)
lines(xbpos~fairprop, lty=1, col="grey50")


rm(list=ls())


midterm<-read.dta("repfairpriority.dta")

attach(midterm)


####REPUBLICAN: PRIORITY#######

plot(x=fairprop, y=rep_priority, pch=20, xlab="FAIR Key Votes", ylab="Priority", yaxt="n",
     main="B.Priority and FAIR Votes", ylim=c(1,4), xlim=c(0,1), col="black", cex.lab=.65, cex.main=.75, cex.axis=.65)
lines(xbpri~fairprop, lty=1)
axis(2, at=(1:4), labels=c("Low", "Med.", "High", "Top"), las=2, cex.axis=.65)
legend("topleft", c("Democrat Incumbent", "Republican Incumbent"), pch=c(20, 20), bty="n", cex=.65, col=c("grey50", "black"))


rm(list=ls())
par(new=TRUE)
############DEMOCRAT PRIORITY##################

midterm<-read.dta("demfairpriority.dta")

attach(midterm)


plot(x=fairprop, y=dem_priority, pch=20, xlab="", ylab="", yaxt="n",
     main="", ylim=c(1,4), xlim=c(0,1), col="grey50", cex.lab=.65, cex.main=.85, cex.axis=.65)
lines(xbpri~fairprop, lty=1, col="gray50")

title("Positioning and Prioritization of Illegal Immigration and F.A.I.R. Support", outer=TRUE, cex.main=.85)
rm(list=ls())

dev.off()
